/* Created by Aquariuslt on 5/20/17.*/
loginController.$inject = ['loginService','$state'];
function loginController(loginService,$state) {
    var vm = this;

    vm.login = function(){
        if(vm.name == undefined || vm.password == undefined){
            alert("name or password cannot empty.");
            return;
        }
        loginService.login(vm.name, vm.password).then(function(data){
            if(data.data){
                //success
                sessionStorage.sysuser = vm.name;
                $state.go("verify");
            }else{
                //failure
                alert("login failure, name or password not correct.");
            }
        });
    }

    
}

module.exports = loginController;